Skip to content

Fix: [BADA-356] SSE 연결 접속 오류 해결#378

Merged
marineAqu merged 1 commit intodevelopfrom
fix/BADA-356-fix-sse-connection
Aug 4, 2025
Merged

Fix: [BADA-356] SSE 연결 접속 오류 해결#378
marineAqu merged 1 commit intodevelopfrom
fix/BADA-356-fix-sse-connection

Conversation

@choyunju
Copy link
Copy Markdown
Contributor

@choyunju choyunju commented Aug 4, 2025

#️⃣연관된 이슈

close: #377

🚀 작업 내용

  • SSE 연결 접속 오류 해결로 헤더 추가

🔍 리뷰 요청 사항

@choyunju choyunju added this to the 🚨 SOS milestone Aug 4, 2025
@choyunju choyunju self-assigned this Aug 4, 2025
@choyunju choyunju added the 🐞 BugFix Something isn't working label Aug 4, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

Failed to generate code suggestions for PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 4, 2025

Walkthrough

NotificationControllersubscribe 메서드가 수정되었습니다. @GetMapping 어노테이션에 produces 속성이 추가되어 MediaType.TEXT_EVENT_STREAM_VALUE로 명시되었습니다. 메서드 시그니처에 HttpServletResponse response 파라미터가 새로 추가되었습니다. 메서드 내부에서는 response 객체에 "Cache-Control": "no-cache", "Connection": "keep-alive", "X-Accel-Buffering": "no" 헤더가 각각 설정됩니다. 이후 기존과 같이 sseService.subscribe에서 반환된 SseEmitter를 반환합니다. 나머지 로직에는 변화가 없습니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5-10 minutes


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 238c6a2 and 9b4ba30.

📒 Files selected for processing (1)
  • src/main/java/com/TwoSeaU/BaData/domain/sos/controller/NotificationController.java (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: choyunju
PR: Ureca-Final-Project-Team2/be_badata#132
File: src/main/java/com/TwoSeaU/BaData/domain/user/dto/response/GetFollowsResponse.java:25-25
Timestamp: 2025-07-17T13:03:43.601Z
Learning: choyunju prefers intuitive field naming in DTOs - even if the API response could use generic names like "username", they prefer to use descriptive field names like "nickname" that clearly indicate the actual data being returned for better code clarity and maintainability.
Learnt from: choyunju
PR: Ureca-Final-Project-Team2/be_badata#267
File: src/main/java/com/TwoSeaU/BaData/domain/user/controller/UserController.java:151-154
Timestamp: 2025-07-28T01:13:39.883Z
Learning: choyunju는 프론트엔드에서 토글 형식으로 구현된 Boolean 파라미터의 경우, null 값이 들어올 수 없다고 판단하여 별도의 null 검증 로직을 추가하지 않는 것을 선호한다. 프론트엔드와 백엔드 간의 계약이 명확할 때 중복 검증을 피하는 설계 접근법을 취한다.
🔇 Additional comments (4)
src/main/java/com/TwoSeaU/BaData/domain/sos/controller/NotificationController.java (4)

3-3: 임포트 추가가 적절합니다.

SSE 연결을 위한 MediaType과 헤더 설정을 위한 HttpServletResponse 임포트가 올바르게 추가되었습니다.

Also applies to: 12-12


21-21: SSE 엔드포인트 명시가 적절합니다.

produces = MediaType.TEXT_EVENT_STREAM_VALUE 속성 추가로 이 엔드포인트가 SSE 스트림을 생성한다는 것을 명확히 표현했습니다. SSE 표준에 맞는 올바른 구현입니다.


22-22: 메서드 시그니처 변경이 적절합니다.

SSE 연결 헤더 설정을 위해 HttpServletResponse response 파라미터가 올바르게 추가되었습니다.


24-26: SSE 연결 안정성을 위한 헤더 설정이 완벽합니다.

세 가지 핵심 헤더가 올바르게 설정되었습니다:

  • Cache-Control: no-cache: SSE 스트림 캐싱 방지
  • Connection: keep-alive: 연결 지속성 보장
  • X-Accel-Buffering: no: nginx 버퍼링 비활성화로 실시간 전송 보장

이 헤더들은 SSE 연결 끊김 문제를 해결하는 표준적인 접근법입니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/BADA-356-fix-sse-connection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

Overall Project 15.01% -0.09%
Files changed 0%

File Coverage
NotificationController.java 0% -66.67%

Copy link
Copy Markdown
Collaborator

@dionisos198 dionisos198 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다.

@marineAqu marineAqu merged commit 1cd8e46 into develop Aug 4, 2025
2 checks passed
@marineAqu marineAqu deleted the fix/BADA-356-fix-sse-connection branch August 4, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BADA-356] [BUG] SSE 오류 해결

3 participants